home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-08-10 | 11.8 KB | 281 lines | [TEXT/MPS ] |
- (*
- File: Translation.mod
-
- Contains: Translation Manager (Macintosh Easy Open) Interfaces.
-
- Version: Technology: Macintosh Easy Open 1.1
- Package: Universal Interfaces 2.0 in “MPW Latest” on ETO #17
-
- Copyright: © 1984-1995 by Apple Computer, Inc.
- All rights reserved.
-
- Bugs?: If you find a problem with this file, use the Apple Bug Reporter
- stack. Include the file and version information (from above)
- in the problem description and send to:
- Internet: apple.bugs.applelink.apple.com
- AppleLink: APPLE.BUGS
-
- *)
-
- (*$TAGS-*)
- (*$CALLING PASCAL*)
- MODULE Translation;
-
- IMPORT SYSTEM, Types, Files, TranslationExtensions;
-
- (* $PUSH*)
- (* $ALIGN MAC68K*)
- (* $LibExport+*)
-
- TYPE
- DocOpenMethod* = INTEGER;
-
-
- CONST
- domCannot* = 0;
- domNative* = 1;
- domTranslateFirst* = 2;
- domWildcard* = 3;
-
- (* 0L terminated array of OSTypes, or FileTypes*)
-
- TYPE
- TypesBlock* = ARRAY 64 (*ΔΔ[0..63]ΔΔ*) OF Types.OSType;
-
- TypesBlockPtr* = POINTER TO TypesBlock (*ΔΔ Types.OSType*);
-
- (* Progress dialog resource AIFF.ID*)
-
- CONST
- kTranslationScrapProgressDialogID* = -16555;
-
- (* block of data that describes how to translate*)
-
- TYPE
- FileTranslationSpec* = RECORD
- componentSignature*: Types.OSType;
- translationSystemInfo*: Types.Ptr;
- src*: TranslationExtensions.FileTypeSpec;
- dst*: TranslationExtensions.FileTypeSpec;
- END;
-
- FileTranslationSpecArrayPtr* = POINTER TO FileTranslationSpec;
-
- (*****************************************************************************************
- *
- * GetFileTypesThatAppCanNativelyOpen
- *
- * This routine returns a list of all FileTypes that an application can open by itself
- *
- * Enter: appVRefNumHint volume where application resides (can be wrong, and if is, will be used as a starting point)
- * appSignature signature (creator) of application
- * nativeTypes pointer to a buffer to be filled with up to 64 FileTypes
- *
- * Exit: nativeTypes zero terminated array of FileTypes that can be opened by app
- *)
-
- PROCEDURE GetFileTypesThatAppCanNativelyOpen*(appVRefNumHint: INTEGER; appSignature: Types.OSType; VAR nativeTypes: TranslationExtensions.FileType): Types.OSErr;
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $701C, $ABFC;
- (*$END*)
- (*****************************************************************************************
- *
- * ExtendFileTypeList
- *
- * This routine makes a new list of file types that can be translated into a type in the given list
- * Used by StandardFile
- *
- * Enter: originalTypeList pointer to list of file types that can be opened
- * numberOriginalTypes number of file types in orgTypeList
- * extendedTypeList pointer to a buffer to be filled with file types
- * numberExtendedTypes max number of file types that can be put in extendedTypeList
- *
- * Exit: extendedTypeList buffer filled in with file types that can be translated
- * numberExtendedTypes number of file types put in extendedTypeList
- *)
- PROCEDURE ExtendFileTypeList*((*CONST*)VAR originalTypeList: TranslationExtensions.FileType; numberOriginalTypes: INTEGER; VAR extendedTypeList: TranslationExtensions.FileType; VAR numberExtendedTypes: INTEGER): Types.OSErr;
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $7009, $ABFC;
- (*$END*)
- (*****************************************************************************************
- *
- *
- * This routine checks if a file can be opened by a particular application.
- * If so, it returns if it needs to be translated first, and if so then how.
- * The FileTypes that the app can open are specified by nativelyOpenableTypes,
- * or if it is NULL, GetFileTypesThatAppCanNativelyOpen is called.
- *
- * Enter: targetDocument document to check if it can be opened
- * appVRefNumHint vRefNum of application to open doc ( can be wrong, and if is, will be used as a starting point)
- * appSignature signature (creator) of application to open doc
- * nativeTypes zero terminated list of FileTypes app can open natively, or NULL to use default list
- * onlyNative whether to consider if document can be translated before opening
- * howToOpen pointer to buffer in which to put how the document can be opened
- * howToTranslate pointer to buffer in which to put a FileTranslationSpec record
- *
- * Exit: howToOpen whether file needs to be translated to be read
- * howToTranslate if file can be translated, buffer filled in with how to translate
- * returns noErr, noPrefAppErr
- *)
- PROCEDURE CanDocBeOpened*((*CONST*)VAR targetDocument: Files.FSSpec; appVRefNumHint: INTEGER; appSignature: Types.OSType; (*CONST*)VAR nativeTypes: TranslationExtensions.FileType; onlyNative: BOOLEAN; VAR howToOpen: DocOpenMethod; VAR howToTranslate: FileTranslationSpec): Types.OSErr;
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $701E, $ABFC;
- (*$END*)
- (*****************************************************************************************
- *
- * GetFileTranslationPaths
- *
- * This routine returns a list of all ways a translation can occure to or from a FileType.
- * The app is checked to exist. The hint for each app is the VRefNum and DTRefNum
- *
- * Enter: srcDoc source file or NULL for all matches
- * dstDoc destination FileType or NULL for all matches
- * maxResultCount
- * resultBuffer
- * Exit: number of paths
- *)
- PROCEDURE GetFileTranslationPaths*(VAR srcDocument: Files.FSSpec; dstDocType: TranslationExtensions.FileType; maxResultCount: INTEGER; resultBuffer: FileTranslationSpecArrayPtr): INTEGER;
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $7038, $ABFC;
- (*$END*)
- (*****************************************************************************************
- *
- * GetPathFromTranslationDialog
- *
- * This routine, with a given document, application, and a passed typelist will display the
- * Macintosh Easy Open translation dialog allowing the user to make a choice. The choice
- * made will be written as a preference (so the next call to CanDocBeOpened() will work).
- * The routine returns the translation path information.
- *
- * Enter: theDocument Files.FSSpec to document to open
- * theApplication Files.FSSpec to application to open document
- * typeList Nil terminated list of FileType's (e.g. StandardFile.SFTypeList-like) of types
- * you would like the documented translated to. Order most perferred
- * to least.
- *
- * Exit: howToOpen Translation method needed to open document
- * howToTranslate Translation specification
- * returns Any errors that might occur.
- *)
- PROCEDURE GetPathFromTranslationDialog*((*CONST*)VAR theDocument: Files.FSSpec; (*CONST*)VAR theApplication: Files.FSSpec; typeList: TypesBlockPtr; VAR howToOpen: DocOpenMethod; VAR howToTranslate: FileTranslationSpec): Types.OSErr;
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $7037, $ABFC;
- (*$END*)
- (*****************************************************************************************
- *
- * TranslateFile
- *
- * This routine reads a file of one format and writes it to another file in another format.
- * The information on how to translated is generated by the routine CanDocBeOpened.
- * TranslateFile calls through to the TranslateFile Extension's DoTranslateFile routine.
- * The destination file must not exist. It is created by this routine.
- *
- * Enter: sourceDocument input file to translate
- * destinationDocument output file of translation
- * howToTranslate pointer to info on how to translate
- * Exit: returns noErr, badTranslationSpecErr
- *)
- PROCEDURE TranslateFile*((*CONST*)VAR sourceDocument: Files.FSSpec; (*CONST*)VAR destinationDocument: Files.FSSpec; (*CONST*)VAR howToTranslate: FileTranslationSpec): Types.OSErr;
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $700C, $ABFC;
- (*$END*)
- (*****************************************************************************************
- *
- * GetDocumentKindString
- *
- * This routine returns the string the Finder should show for the "kind" of a document
- * in the GetInfo window and in the kind column of a list view.
- *
- * Enter: docVRefNum The volume containing the document
- * docType The catInfo.fdType of the document
- * docCreator The catInfo.fdCreator of the document
- * kindString pointer to where to return the string
- *
- * Exit: kindString pascal string. Ex: "\pSurfCalc spreadsheet"
- * returns noErr, or afpItemNoFound if kind could not be determined
- *)
- PROCEDURE GetDocumentKindString*(docVRefNum: INTEGER; docType: Types.OSType; docCreator: Types.OSType; VAR kindString: Types.Str63): Types.OSErr;
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $7016, $ABFC;
- (*$END*)
- (*****************************************************************************************
- *
- * GetTranslationExtensionName
- *
- * This routine returns the translation system name from a specified TranslationSpec
- *
- * Enter: translationMethod The translation path to get the translation name from
- *
- * Exit: extensionName The name of the translation system
- * returns Any errors that might occur
- *)
- PROCEDURE GetTranslationExtensionName*((*CONST*)VAR translationMethod: FileTranslationSpec; VAR extensionName: Types.Str31): Types.OSErr;
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $7036, $ABFC;
- (*$END*)
- (*****************************************************************************************
- *
- * GetScrapDataProcPtr
- *
- * This is a prototype for the function you must supply to TranslateScrap. It is called to
- * get the data to be translated. The first call TranslateScrap will make to this is to
- * ask for the LONG("fmts") data. That is a special. You should resize and fill in the handle
- * with a list all the formats that you have available to be translated, and the length of each.
- * (See I.M. VI 4-23 for details of LONG("fmts")). It will then be called again asking for one of
- * the formats that LONG("fmts") list said was available.
- *
- * Enter: requestedFormat Format of data that TranslateScrap needs.
- * dataH Types.Handle in which to put the requested data
- * srcDataGetterRefCon Extra parameter for you passed to TranslateScrap
- *
- * Exit: dataH Types.Handle is resized and filled with data in requested format
- *)
- TYPE
- GetScrapDataProcPtr* = (*ΔΔ Types.ProcPtr;*) PROCEDURE (requestedFormat: TranslationExtensions.ScrapType; dataH: Types.Handle; srcDataGetterRefCon: (*ΔΔUNIVΔΔ*) Types.Ptr): Types.OSErr;
- GetScrapDataUPP* = Types.UniversalProcPtr;
-
- CONST
- uppGetScrapDataProcInfo* = $00000FE0; (* PROCEDURE (4 byte param, 4 byte param, 4 byte param): 2 byte result; *)
-
- PROCEDURE NewGetScrapDataProc*(userRoutine: GetScrapDataProcPtr): GetScrapDataUPP;
- (*$IF NOT GENERATINGCFM *)
- INLINE PASCAL $2E9F;
- (*$END*)
-
- PROCEDURE CallGetScrapDataProc*(requestedFormat: TranslationExtensions.ScrapType; dataH: Types.Handle; srcDataGetterRefCon: (*ΔΔUNIVΔΔ*) Types.Ptr; userRoutine: GetScrapDataUPP): Types.OSErr;
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $205F, $4E90;
- (*$END*)
-
- TYPE
- GetScrapData* = GetScrapDataUPP;
-
- (*****************************************************************************************
- *
- * TranslateScrap
- *
- * This routine resizes the destination handle and fills it with data of the requested format.
- * The data is generated by translated one or more source formats of data supplied by
- * the procedure srcDataGetter*.
- * This routine is automatically called by GetScrap and ReadEdition. You only need to call
- * this if you need to translated scrap style data, but are not using the ScrapMgr or EditionMgr.
- *
- * Enter: sourceDataGetter Pointer to routine that can get src data
- * sourceDataGetterRefCon Extra parameter for dataGetter
- * destinationFormat Format of data desired
- * destinationData Types.Handle in which to store translated data
- *
- * Exit: dstData Types.Handle is resized and filled with data in requested format
- *)
-
- PROCEDURE TranslateScrap*(sourceDataGetter: GetScrapData; sourceDataGetterRefCon: (*ΔΔUNIVΔΔ*) Types.Ptr; destinationFormat: TranslationExtensions.ScrapType; destinationData: Types.Handle; progressDialogID: INTEGER): Types.OSErr;
- (*$IF NOT GENERATINGCFM*)
- INLINE PASCAL $700E, $ABFC;
- (*$END*)
-
- (* $ALIGN RESET*)
- (* $POP*)
-
- END Translation.
- (*$END*)
-